import axios from "axios";

const http = axios.create({
  timeout: 5000
})

//请求拦截
http.interceptors.request.use((config) => {
  //看响应头允许带哪个?
  //头 带token?
  // config.headers["token"] = localStorage.getItem("token");
  //头 Authorization?
  // config.headers["Authorization"] = localStorage.getItem("token");

  return config;
}, (err) => {
  return Promise.reject(err);
})

//响应拦截
http.interceptors.response.use((response) => {

  return response;
}, (err) => {
  return Promise.reject(err);
})

export default http;
